package com.travelingsalesmen.post;

import java.io.Serializable;

/**
 * An item contains all information about the product (including the quantity)
 * that the the customer wishes to purchase
 */
public class Item implements Serializable {

    private ProductSpec productSpec;
    private int quanitiy;

    public Item(ProductSpec productSpec) {
        this.productSpec = productSpec;
    }

    public Item(ProductSpec productSpec, int quantity) {
        this.productSpec = productSpec;
        this.quanitiy = quantity;
    }

    public int getQty() {
        return quanitiy;
    }

    public String getDescription() {
        return productSpec.getDescription();
    }

    public String getUpc() {
        return productSpec.getUpc();
    }

    public double getSubtotal() {
        return productSpec.getPrice() * quanitiy;
    }

    public double getUnitCost() {
        return productSpec.getPrice();
    }

    public void setQty(int quanitiy) {
        this.quanitiy = quanitiy;
    }
}
